package own.stu.jobgib.playown.fsm.hfsm.states;

import lombok.extern.slf4j.Slf4j;
import own.stu.jobgib.playown.fsm.hfsm.StateBase;
import own.stu.jobgib.playown.fsm.hfsm.StateEnum;

@Slf4j
public class StateBasketball extends StateBase {

    private boolean isHunger;

    private boolean isTried;

    private boolean toWrite;

    public StateBasketball() {
        super(StateEnum.BASKETBALL);
    }

    public void onEnter() {
        log.info("开始打篮球啦，好高兴啊");
    }

    public void onExecute() {
        // 如果饿了
        if (isHunger) {
            transitionEvent(StateEnum.EAT);
        } else if (isTried) //如果累了，切换到休息状态
        {
            transitionEvent(StateEnum.RESET);
        } else if (toWrite) //如果该写作业了，切换到写作业状态
        {
            transitionEvent(StateEnum.HOMEWORK);
        } else {
            log.info("打篮球");
        }
    }

    public void onExit() {
        log.info("停止打篮球");
    }
}
